@extends(config('admin.systems.layout_blade'))

@section('content')
    <div class="row">
        <div class="col-md-12">
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">全站信息配置管理</h3>
                </div>
                    <!-- /.box-tools -->
                <div class="box-body">
                    <form class="form form-horizontal ajax-form" id="form-article-add" method="post" action="{{ get_admin_url('config/setting') }}">
                        <div id="tab-system" class="HuiTab">
                            <div class="tabBar">
                                @foreach(config('admin.systems.config_group_list') as $key=>$value)
                                <a href="{{ get_admin_url('config/setting').'?group='.$key }}" class="@if($key == $group) current @endif">{{ $value }}</a>
                                @endforeach
                            </div>

                            <div class="tabBody">
                                @foreach($data as $key=>$value)
                                    <div class="form-group">
                                        <label for="input-{{ $value->name }}" class="col-sm-1 control-label">{{ $value->title }}</label>
                                        <div class="col-sm-9">
                                            @switch($value->type)
                                                @case(0)
                                                    <input id="input-{{ $value->name }}" type="text" class="form-control"  name="config[{{ $value->id }}]" value="{{ $value->value }}">
                                                @break

                                                @case(1)
                                                    <input id="input-{{ $value->name }}" type="text" class="form-control" name="config[{{ $value->id }}]" value="{{ $value->value }}">
                                                @break

                                                @case(2)
                                                    <textarea id="input-{{ $value->name }}" class="form-control" name="config[{{ $value->id }}]">{{ $value->value }}</textarea>
                                                @break

                                                @case(3)
                                                    <textarea id="input-{{ $value->name }}" class="form-control" name="config[{{ $value->id }}]">{{ $value->value }}</textarea>
                                                @break

                                                @case(4)
                                                    <select id="input-{{ $value->name }}" name="config[{{ $value->id }}]" class="form-control" id="input-is_developer">
                                                        @foreach(parse_config_attr($value->extra) as $k=>$val)
                                                            <option value="{{ $k }}" @if($value->value == $k) selected @endif >{{ $val }}</option>
                                                        @endforeach
                                                    </select>
                                                @break
                                            @endswitch
                                        </div>
                                        <div class="col-sm-2">
                                            {{ $value->remark }}
                                        </div>
                                    </div>
                                @endforeach
                            </div>
                        </div>
                        <div class="row cl">
                            <div class="col-xs-8 col-sm-2 col-xs-offset-4 col-sm-offset-2">
                                <button type="submit" class="btn btn-primary">保存</button>
                                <button type="reset" class="btn btn-primary pull-right">取消</button>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="box-footer clearfix">
                    {{ $data->links() }}
                </div>

            </div>
        </div>
    </div>
@endsection

@section('style')
    <style>
        .tabBar {
            width: 100%;
            height: 32px;
            border-bottom: 2px solid #222;
            clear: none;
        }
        .tabBar a.current {
            background-color: #3c8dbc;
            color: #fff;
        }
        .tabBar a {
            background-color: #ffffff;
            cursor: pointer;
            display: inline-block;
            float: left;
            font-weight: bold;
            height: 30px;
            line-height: 30px;
            padding: 0 15px;
            color: #ff851b;
        }
        .tabBody {
            margin-top: 20px;
        }
        .form .row {
            margin-top: 15px;
        }

        .skin-blue .tabBar {
            border-bottom: 2px solid #3c8dbc;
        }
        .skin-blue .tabBar a.current {
            background-color: #3c8dbc;
        }

        .skin-purple .tabBar {
            border-bottom: 2px solid #605ca8;
        }
        .skin-purple .tabBar a.current {
            background-color: #605ca8;
        }

        .skin-green .tabBar {
            border-bottom: 2px solid #00a65a;
        }
        .skin-green .tabBar a.current {
            background-color: #00a65a;
        }

        .skin-yellow .tabBar {
            border-bottom: 2px solid #f39c12;
        }
        .skin-yellow .tabBar a.current {
            background-color: #f39c12;
        }

        .skin-red .tabBar {
            border-bottom: 2px solid #dd4b39;
        }
        .skin-red .tabBar a.current {
            background-color: #dd4b39;
        }

        .skin-blue-light .tabBar {
            border-bottom: 2px solid #3c8dbc;
        }
        .skin-blue-light .tabBar a.current {
            background-color: #3c8dbc;
        }

        .skin-red-light .tabBar {
            border-bottom: 2px solid #dd4b39;
        }
        .skin-red-light .tabBar a.current {
            background-color: #dd4b39;
        }

        .skin-green-light .tabBar {
            border-bottom: 2px solid #00a65a;
        }
        .skin-green-light .tabBar a.current {
            background-color: #00a65a;
        }

    </style>
@endsection